<template>
  <div class="test">
    <div id="container" style="position: relative;width: 100%;height:500px;"></div>
  </div>
</template>
<script>
import MapLoader from '@/assets/map/AMap.js'
var map
export default {
  name: "NewMap",
  data () {
    return {
      map: null,
      thisPosition: {
        location: '',
        lng: '',
        lat: ''
      },
    }
  },
  mounted: function () {
    this.init()
  },
  methods: {
    init: function () {
      let that = this
      MapLoader().then(AMap => {
        map = new AMap.Map('container', {
          center: [104.072016,30.511076],//需求的城市的经度和 纬度
          resizeEnable: true,
          zoom: 500
        })
        AMap.plugin(['AMap.ToolBar', 'AMap.Scale'], function () {
          map.addControl(new AMap.ToolBar())
          map.addControl(new AMap.Scale())
        })
      })
    },
  }
}
</script>
